package org.example.bigdata.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.bigdata.service.HotspotsService;
import org.example.bigdata.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/hotspots")
public class HotspotsController {
    @Autowired
    private HotspotsService hotspotsService;

    @GetMapping("/fetchHotSpots")
    public Result fetchHotSpots(@RequestHeader String token){
        return hotspotsService.fetchHotSpots(token);
    }

    @GetMapping("/fetchDetails")
    @Transactional
    public Result fetchDetails(@RequestParam("id")int id){
        return hotspotsService.fetchDetails(id);
    }


}
